<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title><?php echo SITE_TITLE?></title>

<link href="<?php echo site_url('dwz/themes/default/style.css');?>" rel="stylesheet" type="text/css" />
<link href="<?php echo site_url('dwz/themes/css/core.css');?>" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="<?php echo site_url('dwz/themes/css/ieHack.css');?>" rel="stylesheet" type="text/css" />
<![endif]-->
<style type="text/css">
#header .logo { text-indent: 0;background:none;font-size: 20px;color:#FFFFFF;padding:12px 0 0 10px;text-decoration: none;font-family: \5FAE\8F6F\96C5\9ED1;}
</style>
<script src="<?php echo site_url('dwz/js/speedup.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/jquery-1.4.4.min.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/jquery.cookie.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/jquery.validate.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/jquery.bgiframe.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/xheditor/xheditor-1.1.6-zh-cn.min.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/dwz.min.js');?>" type="text/javascript"></script>
<script src="<?php echo site_url('dwz/js/dwz.regional.zh.js');?>" type="text/javascript"></script>

<script type="text/javascript">
function closePM(){
    $.cookie('program_maxim',1,{path: '/',expires:1,domain: 'pub.y.pps.tv'});
    return true;
}
jQuery(function($){
	DWZ.init("<?php echo site_url('dwz/dwz.frag.xml');?>", {
//		loginUrl:"loginsub.html", loginTitle:"登录",	// 弹出登录对话框
		loginUrl:"<?php echo site_url('login.php');?>",	// 跳到登录页面
		statusCode:{ok:200, error:300, timeout:301}, //【可选】
		pageInfo:{pageNum:"pageNum", numPerPage:"numPerPage", orderField:"orderField", orderDirection:"orderDirection"}, //【可选】
		debug:false,	// 调试模式 【true|false】
		callback:function(){
			initEnv();
			$("#themeList").theme({themeBase:"<?php echo site_url('dwz/themes');?>"});
            navTab.openTab('main', '<?php echo site_url('index.php?m=index&a=main')?>',{title:'我的主页'});
		}
	});
});
</script>
</head>

<body scroll="no">
	<div id="layout">
		<div id="header">
			<div class="headerNav">
				<a class="logo" href="#"><?php echo SITE_TITLE?></a>
				<ul class="nav">
                    <li><a href="http://www.whoopsfeed.com" target="navTab" rel="www">爱购主页</a></li>
                    <li><a href="<?php echo site_url('index.php?m=index&a=main')?>" target="navTab" rel="main">我的主页</a></li>
					<li id="switchEnvBox"><a href="javascript:void(0)"><?php echo $user_info['user_name']?></a>
						<!--<ul>
                            <?php foreach($user_roles as $v){?>
							<li><?php echo $v['role_name'];?></li>
                            <?php }?>
						</ul>-->
					</li>
					<li><a href="<?php echo site_url('index.php?m=user&a=edituser');?>&user_id=<?php echo $user_info['user_id']?>&editrole=0" target="dialog" height="350" rel="edit_user">设置</a></li>
					<li><a href="<?php echo site_url('logout.php');?>">退出</a></li>
				</ul>
				<ul class="themeList" id="themeList">
					<li theme="default"><div class="selected">蓝色</div></li>
					<li theme="green"><div>绿色</div></li>
					<li theme="purple"><div>紫色</div></li>
					<li theme="silver"><div>银色</div></li>
					<li theme="azure"><div>天蓝</div></li>
				</ul>
			</div>

			<!-- navMenu -->
			
		</div>

		<div id="leftside">
			<div id="sidebar_s">
				<div class="collapse">
					<div class="toggleCollapse"><div></div></div>
				</div>
			</div>
			<div id="sidebar">
				<div class="toggleCollapse"><h2>主菜单</h2><div>收缩</div></div>
                <?php
                    function getTree($data,$user_cate_ids)
                    {
                        $html = '';
                        foreach($data as $k => $v)
                        {
                            if(in_array($v['cate_id'],$user_cate_ids) && $v['is_show']){
                                if(isset($v['cate_child']))
                                {   //父亲找到儿子
                                    $html .= '<li><a>'.$v['cate_name'].'</a>';
                                    $html .= getTree($v['cate_child'],$user_cate_ids);
                                    $html .= '</li>';
                                }else{
                                    $arr = parse_url($v['action']);
                                    parse_str($arr['query'], $url_param);
                                    $rel = (isset($url_param['m']) ? $url_param['m'] : '').(isset($url_param['a']) ? $url_param['a'] : '');
                                    $html .= '<li><a href="'.($v['type'] == 1 ? $v['action'] : site_url($v['action'])).'" '.($v['type'] == 1 ? "external='true'" : '').'  target="navTab" rel="'.$rel.'">'.$v['cate_name'].'</a></li>';
                                }
                            }
                        }
                        return '<ul>'.$html.'</ul>';
                    }

                    $parent_array = array();//记录每一个父节点的地址引用
                    $tree_array = array();//整颗树的数组

                    foreach($menu_arr as $v){

                        $node_num = ($v['right_value']-$v['left_value'] - 1)/2;

                        if($v['parent_cate_id']){//如果没有parent_cate_id则是顶层

                            $parent_array[$v['parent_cate_id']]['cate_child'][$v['cate_id']] = $v;

                            if($node_num > 0){

                                $parent_array[$v['cate_id']] = &$parent_array[$v['parent_cate_id']]['cate_child'][$v['cate_id']];
                            }

                        }else{
                            $tree_array[$v['cate_id']] = $v;

                            if($node_num > 0){

                                $parent_array[$v['cate_id']] = &$tree_array[$v['cate_id']];
                            }
                        }
                    }
                ?>
				<div class="accordion" fillSpace="sidebar">
                    <?php foreach($tree_array as $value){
                    if(in_array($value['cate_id'],$user_cate_ids) && $value['is_show']){
                    ?>
					<div class="accordionHeader">
						<h2><span>Folder</span><?php echo $value['cate_name'];?></h2>
					</div>
					<div class="accordionContent">
						<ul class="tree treeFolder">
                            <?php if($value['cate_child']) echo substr(substr(getTree($value['cate_child'],$user_cate_ids),4),0,-5);?>
						</ul>
					</div>
                    <?php }}?>
				</div>

			</div>
		</div>
		<div id="container">
			<div id="navTab" class="tabsPage">
				<div class="tabsPageHeader">
					<div class="tabsPageHeaderContent"><!-- 显示左右控制时添加 class="tabsPageHeaderMargin" -->
						<ul class="navTab-tab">
							<li tabid="main" class="main"><a href="javascript:;"><span><span class="home_icon">我的主页</span></span></a></li>
						</ul>
					</div>
					<div class="tabsLeft">left</div><!-- 禁用只需要添加一个样式 class="tabsLeft tabsLeftDisabled" -->
					<div class="tabsRight">right</div><!-- 禁用只需要添加一个样式 class="tabsRight tabsRightDisabled" -->
					<div class="tabsMore">more</div>
				</div>
				<ul class="tabsMoreList">
					<li><a href="javascript:;">我的主页</a></li>
				</ul>
				<div class="navTab-panel tabsPageContent">
                    <div class="pager"></div>
                </div>
			</div>
		</div>

		<div id="taskbar" style="left:0px; display:none;">
			<div class="taskbarContent">
				<ul></ul>
			</div>
			<div class="taskbarLeft taskbarLeftDisabled" style="display:none;">taskbarLeft</div>
			<div class="taskbarRight" style="display:none;">taskbarRight</div>
		</div>
		<div id="splitBar"></div>
		<div id="splitBarProxy"></div>
	</div>

	<div id="footer">Copyright &copy; 2012 爱购后台管理系统</div>

<!--拖动效果-->
	<div class="resizable"></div>
<!--阴影-->
	<div class="shadow" style="width:508px; top:148px; left:296px;">
		<div class="shadow_h">
			<div class="shadow_h_l"></div>
			<div class="shadow_h_r"></div>
			<div class="shadow_h_c"></div>
		</div>
		<div class="shadow_c">
			<div class="shadow_c_l" style="height:296px;"></div>
			<div class="shadow_c_r" style="height:296px;"></div>
			<div class="shadow_c_c" style="height:296px;"></div>
		</div>
		<div class="shadow_f">
			<div class="shadow_f_l"></div>
			<div class="shadow_f_r"></div>
			<div class="shadow_f_c"></div>
		</div>
	</div>
	<!--遮盖屏幕-->
	<div id="alertBackground" class="alertBackground"></div>
	<div id="dialogBackground" class="dialogBackground"></div>

	<div id='background' class='background'></div>
	<div id='progressBar' class='progressBar'>数据加载中，请稍等...</div>
</body>
</html>